package com.mephi.model;

import com.mephi.util.AuxClass;

/**
 * This class represents move in chess.
 * 
 * @author GM Mephisto
 * @since 2011-04-21
 */
public class Move
{
	/**
	 * @param whiteMove the whiteMove to set 
	 * @param blackMove the blackMove to set
	 * set null if the previous white move is the last
	 */
	public Move(String whiteMove, String blackMove)
	{
		this(whiteMove, blackMove, null, null);
	}

	/**
	 * 
	 * @param whiteMove the whiteMove to set 
	 * @param blackMove the blackMove to set
	 * 		set null if the previous white move is the last
	 * @param commentToWhiteMove the commentToWhiteMove to set 
	 * @param commentToBlackMove the commentToBlackMove to set 
	 */
	public Move(String whiteMove, String blackMove, String commentToWhiteMove,
			String commentToBlackMove)
	{
		setWhiteMove(whiteMove);
		setBlackMove(blackMove);
		toStringSize = 10;
		setCommentToWhiteMove(commentToWhiteMove);
		setCommentToBlackMove(commentToBlackMove);
	}

	/**
	 * @return the whiteMove
	 */
	public String getWhiteMove()
	{
		return whiteMove;
	}
	
	/**
	 * @param whiteMove the whiteMove to set
	 */
	public void setWhiteMove(String whiteMove)
	{
		this.whiteMove = whiteMove;
	}
	
	/**
	 * @return the blackMove
	 */
	public String getBlackMove()
	{
		return blackMove;
	}
	
	/**
	 * @param blackMove the blackMove to set
	 * set null if the previous white move is the last
	 */
	public void setBlackMove(String blackMove)
	{
		this.blackMove = blackMove;
	}
	
	/**
	 * @return the commentToWhiteMove
	 */
	public String getCommentToWhiteMove()
	{
		return commentToWhiteMove;
	}

	/**
	 * @param commentToWhiteMove the commentToWhiteMove to set
	 */
	public void setCommentToWhiteMove(String commentToWhiteMove)
	{
		this.commentToWhiteMove = commentToWhiteMove;
		if (commentToWhiteMove != null)
			toStringSize += commentToWhiteMove.length();
	}

	/**
	 * @return the commentToBlackMove
	 */
	public String getCommentToBlackMove()
	{
		return commentToBlackMove;
	}

	/**
	 * @param commentToBlackMove the commentToBlackMove to set
	 */
	public void setCommentToBlackMove(String commentToBlackMove)
	{
		this.commentToBlackMove = commentToBlackMove;
		if (commentToBlackMove != null)
			toStringSize += commentToBlackMove.length();
	}

	public String toString()
	{
		return AuxClass.toString(this, toStringSize);
	}
	
	private String whiteMove;
	private String blackMove;
	private String commentToWhiteMove;
	private String commentToBlackMove;
	private int toStringSize;
}
